package com.landerer.gui.emgmt;

import java.io.Serializable;

import javax.ejb.EJB;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.inject.Named;

import com.landerer.service.EmployeeServiceRemoteBusiness;

@Named
@RequestScoped
public class CreateEmployeeBean implements Serializable {

	private static final long serialVersionUID = -7307662873625479569L;

	@EJB
	private EmployeeServiceRemoteBusiness service;
	
	@Inject
	private EmployeeBean employeeBean;
	
	private String name;
	private long salary;
	
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public long getSalary() {
		return salary;
	}
	public void setSalary(long salary) {
		this.salary = salary;
	}
	
	public String createEmployee() {
		this.service.createEmployee(this.name, this.salary);
		return this.employeeBean.findAllEmployees();
	}
	
	public String reset() {
		this.name = null;
		this.salary = 0;
		return null;
	}
}
